﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;

namespace FlexiCommerce.Security
{
    public interface ISecurityManager
    {
        /// <summary>Checks wether a user is an administrator.</summary>
        /// <param name="user">The user to check.</param>
        /// <returns>True if the user is an administrator.</returns>
        bool IsSystemAdmin(IPrincipal user);

        bool IsMarketingManager(IPrincipal user);

        bool IsCatalogManager(IPrincipal user);

        bool IsOrderManager(IPrincipal user);

        /// <summary>Gets or sets wether this security manager is enabled.</summary>
        bool Enabled { get; set; }

        /// <summary>Gets or sets wether this security manager is enabled in the current scope. In a web application this is equivalent to a request.</summary>
        bool ScopeEnabled { get; set; }

        /// <summary>Finds out wether a user has one of the given accesses.</summary>
        bool IsAuthorized(IPrincipal user, IEnumerable<string> roles);
    }
}
